package com.example.mediaplayer;

import android.app.Activity;
import android.app.ActionBar;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.os.Build;

public class MainActivity extends Activity {

	public RoundProgressBar rpb;
	public ImageView left_button;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        rpb = (RoundProgressBar)findViewById(R.id.roundProgressBar2);
        left_button = (ImageView)findViewById(R.id.left_bottom);
        left_button.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View arg0) {
				// TODO Auto-generated method stub
				Intent intent = new Intent();
				intent.setClass(MainActivity.this, MediaList.class);
				startActivity(intent);
				overridePendingTransition(R.anim.in_from_right, R.anim.left_to_right);
			}
		});
        //rpb.setProgress(50);
        handler.post(updateProgress);
    }
    Handler handler = new Handler(){  
        @Override  
        public void handleMessage(Message msg) {  
            super.handleMessage(msg);  
            rpb.setProgress(msg.arg1);  
            handler.postDelayed(updateProgress,100);  
    }};
    
    Runnable updateProgress = new Runnable() {  
        int i=0;  
        @Override  
        public void run() {  
            i++;  
            Message msg = handler.obtainMessage();  
            msg.arg1=i;  
            handler.sendMessage(msg);  
            if(i==100){  
                //handler.removeCallbacks(updateProgress);
            	i = 0;
            }  
        }  
    };  
}
